import { createSSRApp } from "vue";
import App from "./App.vue";
import { store } from "@/stores/index";
import Cache from "@/utils/cache";
import util from "@/utils/util";
import * as configs from "@/config/app.js";

import * as Order from "@/libs/order";
// import base  from '@/components/base/index' // 公共组件
import * as filter from "@/filter";
import uviewPlus from "uview-plus";

import i18n from "@/locale/index";


// Object.keys(filters).forEach(key => {
// 	Vue.filter(key, filters[key])
//   })

// const i18n = createI18n(i18nConfig)
export function createApp() {
	const app = createSSRApp(App);
	app.config.globalProperties.$filters = filter;
	app.config.globalProperties.$util = util;
	app.config.globalProperties.$config = configs;
	app.config.globalProperties.$Cache = Cache;
	app.config.globalProperties.$Order = Order;
	// app.config.globalProperties.tui = tui;

	app.use(uviewPlus);
	app.use(i18n);
	app.use(Cache);
	app.use(store);
	uni.$u.setConfig({
		// 修改$u.props对象的属性
		props: {
			// 修改radio组件的size参数的默认值，相当于执行 uni.$u.props.radio.size = 30
			navbar: {
				border: false,
				placeholder: true,
				leftIconColor: "#fff",
				leftIconSize: "32rpx",
			},
		},
	});

	return {
		app,
	};
}
